package com.gs.SynAntiWandering.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.gs.SynAntiWandering.R;
import com.gs.SynAntiWandering.constant.AllConstants;
import com.gs.SynAntiWandering.util.AppUtil;
import com.gs.SynAntiWandering.util.SPUtil;
import com.gs.SynAntiWandering.util.WindowUtil;

public class WelcomeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        WindowUtil.setWindowDecorView(this);
        TextView tvVersion = findViewById(R.id.tv_version);
        tvVersion.setText(AppUtil.getInstance().getVersion());
        new Handler(Looper.getMainLooper()).postDelayed(() -> {
            if (TextUtils.isEmpty(SPUtil.getInstance().getString(AllConstants.TOKEN))) {
                startActivity(new Intent(WelcomeActivity.this, LoginActivity.class));
            } else {
                startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
            }
            finish();
        }, 3000);
    }
}